The two primary package managers for Node.js applications, including for JavaScript/TypeScript are NPM and Yarn. Additions to the Plug 'n' Play strategy have yielded current state-of-the-art package managers
- PNPM: An stand-in NPM replacement (my personal favourite).
- Yarn 2 (with Plug 'n' Play): The second generation of the awesome Yarn package manager.
Using (P)NPM
Note that I will be using the
npm
butpnpm
can be used as a direct replacement for this command. Many people set thealias npm=pnpm
To install Node Package Manager (NPM) on Ubuntu/Debian use
sh
sudo apt install npm nodejs
sudo apt install npm nodejs
To change versions, install Node Version Manager (NVM) with the following install script
sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Then change version with
sh
nvm install 14
nvm use 14
nvm -v
nvm install 14
nvm use 14
nvm -v
Using Yarn
Install Yarn through NPM.
sh
npm install --global yarn
npm install --global yarn